<?php

namespace App\Http\Controllers\CmsApi;

use Illuminate\Http\Request;
use App\Lib\Response;
use App\Http\Model\Hint;
use App\Http\Controllers\BaseController;
use App\Http\Services\SettleServices;

class InnerSettleController extends BaseController
{
    protected $settle_service;
    protected $gift_service;//送礼服务

    public function __construct()
    {
        $this->settle_service = new SettleServices();
    }

    /**
     * 公会结算审核
     */
    public function unionSettleAudit(Request $request)
    {
        $id = (int) $request->input('id');
        $status = (int) $request->input('status');
        $audit_msg = (string) $request->input('audit_msg', '');
        if(empty($id) || empty($status)) {
            Response::returnResult(Hint::PARAM_ERROR);
        }
        if(!in_array($status, [3, 4, 5])) {
            Response::returnResult(Hint::PARAM_ERROR, [], '状态选择错误');
        }

        $data = $this->settle_service->unionSettleAudit($id, $status, $audit_msg);
        if($data['code'] != Hint::SUCCESS) {
            Response::returnResult($data['code'], $data['data'], $data['msg']);
        }

        Response::returnResult(Hint::SUCCESS);
    }
}